package com.hksj.cockpit.controller;

import com.hksj.base.vo.DeviceOverviewVO;
import com.hksj.base.vo.PropertyVO;
import com.hksj.cockpit.dto.ComprehensiveCockpitDTO;
import com.hksj.cockpit.dto.ComprehensiveCockpitEnergyDTO;
import com.hksj.cockpit.service.LaboratoryIntegrationCockpitService;
import com.hksj.cockpit.vo.AlarmRecordVO;
import com.hksj.common.core.model.Rest;
import com.hksj.ecm.vo.EnergyTrendVO;
import com.hksj.vsm.vo.PlayVideoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @author fjt
 * @data 2024/10/21 11:08
 * @describe
 */
@Api(tags = "实验室-综合大屏")
@RestController
@RequestMapping("/api/laboratoryCockpit")
public class LaboratoryIntegrationCockpitController {

    @Autowired
    private LaboratoryIntegrationCockpitService laboratoryIntegrationCockpitService;



    @PostMapping("/selectDevice")
    @ApiOperation(value = "环境概览", response = PropertyVO.class)
    public Rest<List<PropertyVO>> selectDevice(@RequestBody ComprehensiveCockpitDTO dto) {
        return Rest.ok(laboratoryIntegrationCockpitService.selectDevice(dto));
    }


    @PostMapping("/deviceOverview")
    @ApiOperation(value = "设备概览")
    public Rest<Map<String, String>> deviceOverview(@RequestBody ComprehensiveCockpitDTO dto) {
        return Rest.ok(laboratoryIntegrationCockpitService.deviceOverview(dto));
    }


    @PostMapping("/alarmRecord")
    @ApiOperation(value = "系统报警概览", response = AlarmRecordVO.class)
    public Rest<List<AlarmRecordVO>> queryAlarmRecord(@RequestBody ComprehensiveCockpitDTO dto) {
        return Rest.ok(laboratoryIntegrationCockpitService.alarmRecord(dto));
    }


    @PostMapping("/videoDeviceOverview")
    @ApiOperation(value = "视频监控-设备概览", response = DeviceOverviewVO.class)
    public Rest<DeviceOverviewVO> videoDeviceOverview(@RequestBody ComprehensiveCockpitDTO dto){
        return Rest.ok(laboratoryIntegrationCockpitService.videoDeviceOverview(dto));
    }


    @PostMapping("/queryListPlayVideoInfo")
    @ApiOperation(value = "视频监控-查询多个摄像头监控视频",response = PlayVideoVO.class)
    public Rest<List<PlayVideoVO>> queryListPlayVideoInfo(@RequestBody ComprehensiveCockpitDTO dto){
        return Rest.ok(laboratoryIntegrationCockpitService.queryListPlayVideoInfo(dto));
    }


    @PostMapping("/queryEnergyTotal")
    @ApiOperation(value = "能耗概览-用水和电的总量")
    public Rest<Map<String, BigDecimal>> queryEnergyTotal(@RequestBody @Valid ComprehensiveCockpitEnergyDTO dto){
        return Rest.ok(laboratoryIntegrationCockpitService.queryEnergyTotal(dto));
    }


    @PostMapping("/energyTrend")
    @ApiOperation(value = "能耗概览-趋势查询", response = EnergyTrendVO.class)
    public Rest<Map<String, List<EnergyTrendVO>>> energyTrend(@RequestBody @Valid ComprehensiveCockpitEnergyDTO dto){
        return Rest.ok(laboratoryIntegrationCockpitService.energyTrend(dto));
    }


}
